class Api::V1::SessionController < ApplicationController
  before_action :decodeURIParameters
  #Login
  def create
    u = params[:email]
	  p = params[:password]
	  f = params[:facebookid]
	
	@uDB = PhoneUser.select( "api_key as sessionid,id" ).where( username:u , userpass:p  ).first or not_found
  response.headers['Sessionid'] = @uDB.sessionid
	render :json => ""
  end
  
  #Close session
  def destroy
	u = params[:sessionid]
	render :json => u
  end
  
  #Validate session
  def update
	u = params[:sessionid]
	@uDB = PhoneUser.where( api_key:u  ).first or not_found
  end
end